mod ninetable;
mod simplehttp;

fn main() {
    println!("normal");
    ninetable::normal_9();
    println!("fire");
    ninetable::fire_9();

    println!("water");
    ninetable::water_9();

    println!("electric");
    ninetable::electric_9();

    println!("grass");
    ninetable::grass_9();

    println!("ice");
    ninetable::ice_9();

    println!("fighting");
    ninetable::fighting_9();

    println!("poison");
    ninetable::poison_9();

    let y = 10;
    let addy = |x| x+y;
    let copy_let_add_y = addy;
    println!("{}", addy(copy_let_add_y(22)));


    let mut x = 10;
    let addx = |y| {x += y; x};
    let mut copy_let_add_x = addx;
    println!("{}", copy_let_add_x(22));
    // addx(22);由于是mut可变的，所以闭包后就不能COPY了， 所以copy_let_add_x(22)已经拿走了addx(22)的权利
    // println!("addx(22) = {}", addx(22));

    // move 闭包的测试
    let mut greeting = "hello".to_string();
    let mut greet = move |name| {
        greeting.push_str(name);
        println!("{}", greeting);
    };
    // 添加下面这一行的区别是啥， 一后面的clone都有 world , 另一个要求greet必须是 mut 的， 否则greet可以是不可变的
    greet(" world");
    greet.clone()(" world");
    greet.clone()(" wang");

}

